package cn.iocoder.yudao.module.famous.doctor.dal.mysql.agreement;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.famous.doctor.dal.dataobject.agreement.AgreementDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.famous.doctor.controller.admin.agreement.vo.*;

/**
 * 协议文档 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface AgreementMapper extends BaseMapperX<AgreementDO> {

    default PageResult<AgreementDO> selectPage(AgreementPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AgreementDO>()
                .eqIfPresent(AgreementDO::getTitle, reqVO.getTitle())
                .eqIfPresent(AgreementDO::getImage, reqVO.getImage())
                .eqIfPresent(AgreementDO::getRemark, reqVO.getRemark())
                .eqIfPresent(AgreementDO::getContent, reqVO.getContent())
                .betweenIfPresent(AgreementDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AgreementDO::getId));
    }

    default List<AgreementDO> selectList(AgreementExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<AgreementDO>()
                .eqIfPresent(AgreementDO::getTitle, reqVO.getTitle())
                .eqIfPresent(AgreementDO::getImage, reqVO.getImage())
                .eqIfPresent(AgreementDO::getRemark, reqVO.getRemark())
                .eqIfPresent(AgreementDO::getContent, reqVO.getContent())
                .betweenIfPresent(AgreementDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AgreementDO::getId));
    }

}
